import 'package:p_location/home/obj/area_car_obj.dart';
import 'package:p_location/home/obj/area_person_obj.dart';

class AreaDetailInfoItem {
  List<AreaPersonObj> userList;
  List<AreaCarObj> vehiclelist;

  List<AreaPersonObj> employee;
  List<AreaCarObj> carOwner;
  List<AreaPersonObj> guest;
  List<AreaCarObj> carVisit;
  List<AreaPersonObj> worker;

  AreaDetailInfoItem(
      {this.userList,
        this.vehiclelist,
      this.employee,
      this.carOwner,
      this.guest,
      this.carVisit,
      this.worker});

  factory AreaDetailInfoItem.fromJson(Map<String, dynamic> json) {
    return AreaDetailInfoItem(
      userList: json['userList'] != null
          ? (json['userList'] as List)
          .map((i) => AreaPersonObj.fromJson(i, "内部员工"))
          .toList()
          : null,
      vehiclelist: json['vehiclelist'] != null
          ? (json['vehiclelist'] as List)
          .map((i) => AreaCarObj.fromJson(i, "内部员工"))
          .toList()
          : null,
      employee: json['内部员工'] != null
          ? (json['内部员工'] as List)
              .map((i) => AreaPersonObj.fromJson(i, "内部员工"))
              .toList()
          : null,
      carOwner: json['内部车辆'] != null
          ? (json['内部车辆'] as List)
              .map((i) => AreaCarObj.fromJson(i, "内部车辆"))
              .toList()
          : null,
      guest: json['外来访客'] != null
          ? (json['外来访客'] as List)
              .map((i) => AreaPersonObj.fromJson(i, '外来访客'))
              .toList()
          : null,
      carVisit: json['外来车辆'] != null
          ? (json['外来车辆'] as List)
              .map((i) => AreaCarObj.fromJson(i, "外来车辆"))
              .toList()
          : null,
      worker: json['承包商'] != null
          ? (json['承包商'] as List)
              .map((i) => AreaPersonObj.fromJson(i, '外来访客'))
              .toList()
          : null,
    );
  }
}
